home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17709 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  77 lines

  1. Path: d128-1.cpe.melbourne.aone.net.au!user
  2. From: reality@c031.aone.net.au (Virgil Reality)
  3. Newsgroups: comp.lang.c++
  4. Subject: Getting a simple string class on the Mac to work?
  5. Date: Wed, 17 Apr 1996 18:16:19 +1000
  6. Organization: Reality Bytes
  7. Message-ID: <reality-1704961816190001@d128-1.cpe.melbourne.aone.net.au>
  8. Reply-To: reality@c031.aone.net.au
  9. NNTP-Posting-Host: d128-1.cpe.melbourne.aone.net.au
  10.  
  11. Hi 
  12.  
  13. I am trying to do my University Homework at home on my Mac and just converting
  14. simple stuff over to my compiler. 
  15.  
  16. I am a real newbie to C++ and all I want to do is use cstring.h. 
  17. The word is "string" in Borland and "CString" in Symantec for the Macintosh.
  18.  
  19. The problem is the Borland version compiles with ease and the Symantec
  20. version gives me some error about void.(See Below).
  21.  
  22. It╣s so simple and yet I can╣t understand what's wrong. I am only trying
  23. to be ANSI C++ compliant at this level of my course.
  24.  
  25.  
  26.  
  27. // Borland Windows Version 4.5
  28. #include <cstring.h>
  29. #include <iostream.h>
  30.  
  31. void main()
  32. {
  33.    cout << "What is your name?" << endl;
  34.    string name;
  35.    cin >> name;
  36.    cout << "Your name is " << name << endl;
  37.    
  38.    return;
  39. }
  40.  
  41. This works fine no problems.
  42.  
  43.  
  44. // Symantec Macintosh Version 8.4 
  45. #include <cstring.h>
  46. #include <iostream.h>
  47.  
  48. void main()
  49. {
  50.    cout << "What is your name?" << endl;
  51.    CString name;
  52.    cin >> name;
  53.    cout << "Your name is " << name << endl;
  54.    
  55.    return;
  56. }
  57.  
  58.  
  59. This does not compile yet it is a simple string class no tricks.
  60. What's wrong with my compiler.
  61. I╣m only setting up my project as ANSI C++ Compliant
  62.  
  63. The errors are.
  64.  
  65. File │main.cp▓; Line 12
  66. Error:   illegal operand types
  67. Had: void *
  68.  
  69. File │main.cp▓; Line 12
  70. Warning:   value of expression is not used
  71.  
  72.  
  73. Thanks in advance for your help.
  74.  
  75. Kindest Regards
  76. Virgil Reality...
  77.